<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Illuminate\Routing\Router;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

//Route::middleware('auth:api')->get('/user', function (Request $request) {
//    return $request->user();
//});


//登入
Route::post('/login', 'Guest@login');
Route::post('/reg', 'Guest@reg');


//图形验证码：  url http://blog.martin.net/api/captcha
Route::get('/captcha', 'Guest@captcha');
Route::get('/test', 'TestController@index');


# 用户信息
//Route::prefix('me')
//    ->middleware(['api'])     //中间件
//    ->group(function () {
//        Route::get('info', 'Me@info');
//        Route::post('info/save', 'Me@saveInfo');
//        Route::post('info/uploadImg', 'Me@uploadImg');
//
//    });


Route::group([
    'middleware' => 'api',
], function (Router $router) {

    Route::get('config', 'ConfigController@index');
    Route::get('users', 'User@ls');
    Route::post('staff/import', 'StaffController@importStaff');// 不要使用import 关键字
    Route::get('staff/importTpl', 'StaffController@importTpl');
    Route::get('staff/export', 'StaffController@export');
    Route::resource('staff', StaffController::class);

    Route::get('me', 'Me@info');
    Route::get('auth/roles', 'Me@roles');
//    Route::post('me', 'AuthController@me');
    Route::resource('menus', MenuController::class);
    Route::resource('exchange', ExchangeRateController::class);
    $router->resource('orderTemplate', OrderTemplateController::class);
    $router->resource('orderTemplateExp', OrderTemplateExpController::class);

    //进出口商管理
    $router->resource('customs_exporter', CustomsExporterController::class);
    //港口管理
    $router->resource('customs_harbour', CustomsHarbourController::class);
    $router->resource('contract', ContractController::class);

});
